<?php
/**
 * 订单的自动归档
    1、自动归档当前时间往前推三个月的订单
    2、每日凌晨定时任务自动处理
    3、调用系统归档记录，将数据全部丢到archive APP应用下
    4、通过查询的数据，每次归档500条，最终归档完成截至
 * @author liuhua@leemanpaper.com
 * @version $20180411
 */
$domain = $argv[1];

if (empty($domain)) {
    die('No Params');
}
set_time_limit(0);
require_once(dirname(__FILE__) . '/../../lib/init.php');
cachemgr::init(false);
$_SERVER['HTTP_HOST'] = $domain;

 $sdf = array ( 'shop_type' => 'taobao', 'node_id' => '1848109335', 'order_bn' => '669554784562071275', 'status' => 'active', 'pay_status' => 1, 'ship_status' => 0, 'is_delivery' => '', 't_type' => 'fixed', 'fx_order_id' => NULL, 'tc_order_id' => NULL, 'omnichannel_param' => '', 'shipping' => array ( 'shipping_name' => '快递', 'cost_shipping' => 0, 'is_protect' => '', 'cost_protect' => '', 'is_cod' => 'false', ), 'payinfo' => array ( 'pay_name' => '支付宝', 'cost_payment' => NULL, ), 'is_sh_ship' => 'false', 'pay_bn' => 'alipay', 'weight' => '', 'title' => '理文官方店', 'createtime' => '2018-12-11 11:24:17', 'consignee' => array ( 'name' => '小徐', 'area_state' => '广东省', 'area_city' => '东莞市', 'area_district' => '', 'addr' => '洪梅镇河西工业区广东理文造纸有限公司', 'zip' => '000000', 'telephone' => '', 'mobile' => '13469888322', 'email' => NULL, 'r_time' => '', ), 'consigner' => array ( 'name' => '小徐', 'area_state' => '广东省', 'area_city' => '东莞市', 'area_district' => '', 'addr' => '洪梅镇河西工业区广东理文造纸有限公司', 'zip' => '000000', 'telephone' => '', 'mobile' => '13469888322', 'email' => NULL, ), 'selling_agent' => array ( 'member_info' => array ( 'uname' => NULL, 'name' => NULL, 'level' => NULL, 'birthday' => NULL, 'sex' => NULL, 'area_state' => NULL, 'area_city' => NULL, 'area_district' => NULL, 'addr' => NULL, 'zip' => NULL, 'telephone' => NULL, 'mobile' => NULL, 'email' => NULL, ), 'website' => array ( 'name' => NULL, 'domain' => NULL, 'logo' => '', ), ), 'member_info' => '{"uname":"\\u9e2d\\u5b50cc","name":"\\u9e2d\\u5b50cc","alipay_no":"luffy1518@dingtalk.com","area_state":null,"area_city":null,"area_district":null,"addr":null,"mobile":null,"tel":null,"email":"ya.zi.123@163.com","zip":null}', 'order_source' => NULL, 'pmt_detail' => array ( 0 => array ( 'pmt_amount' => '201.00', 'pmt_describe' => '早买早优惠', ), 1 => array ( 'pmt_amount' => '0.00', 'pmt_describe' => '测试', ), ), 'other_list' => '[]', 'payments' => array ( 0 => array ( 'trade_no' => '2018121122001116215453255075', 'money' => '85.26', 'pay_time' => '2018-12-11 11:24:21', 'account' => 'hanky@leemantissue.com', 'bank' => NULL, 'pay_bn' => NULL, 'paycost' => NULL, 'pay_account' => 'luffy1518@dingtalk.com', 'paymethod' => '', 'memo' => '', ), ), 'cost_item' => '1399.00', 'is_tax' => 'false', 'cost_tax' => '', 'tax_title' => '', 'invoice_kind' => '', 'currency' => 'CNY', 'cur_rate' => 1, 'score_u' => 0, 'score_g' => 0, 'discount' => 0, 'pmt_goods' => '1313.74', 'pmt_order' => '0.00', 'total_amount' => '85.26', 'payed' => '85.26', 'custom_mark' => '', 'mark_text' => '测试单，勿发！', 'buyer_flag' => '', 'mark_type' => 'b1', 'tax_no' => NULL, 'order_limit_time' => '2018-12-11 11:24:21', 'coupons_name' => NULL, 'order_type' => 'normal', 'is_force_wlb' => 'False', 'is_lgtype' => 'False', 'order_objects' => array ( 0 => array ( 'is_sh_ship' => '', 'obj_type' => 'goods', 'shop_goods_id' => 569729269769, 'oid' => '289554784563070069', 'obj_alias' => '商品', 'bn' => 'BR3136S0606', 'name' => '亨奇纸巾璞竹本色纸抽纸婴儿宝宝专用竹纤维原浆纸家庭装整箱6包', 'price' => 96, 'amount' => '288.0', 'sale_price' => '', 'quantity' => 3, 'weight' => '', 'score' => 0, 'is_oversold' => false, 'fx_oid' => NULL, 'tc_order_id' => NULL, 'cost_tax' => NULL, 'buyer_payment' => NULL, 'order_items' => array ( 0 => array ( 'item_type' => 'product', 'shop_goods_id' => 569729269769, 'shop_product_id' => '', 'bn' => 'BR3136S0606', 'name' => '亨奇纸巾璞竹本色纸抽纸婴儿宝宝专用竹纤维原浆纸家庭装整箱6包', 'product_attr' => array ( ), 'quantity' => 3, 'price' => '96.00', 'amount' => '288.0', 'pmt_price' => '202.74', 'sale_price' => '', 'weight' => '', 'score' => '', 'status' => 'active', 'fx_oid' => NULL, 'cost_tax' => NULL, 'buyer_payment' => NULL, ), ), 'pmt_price' => 0, ), 1 => array ( 'is_sh_ship' => '', 'obj_type' => 'goods', 'shop_goods_id' => 584048755900, 'oid' => '289554784564070069', 'obj_alias' => '商品', 'bn' => 'BR3136S0606', 'name' => '测试', 'price' => 1111, 'amount' => '1111.0', 'sale_price' => '', 'quantity' => 1, 'weight' => '', 'score' => 0, 'is_oversold' => false, 'fx_oid' => NULL, 'tc_order_id' => NULL, 'cost_tax' => NULL, 'buyer_payment' => NULL, 'order_items' => array ( 0 => array ( 'item_type' => 'product', 'shop_goods_id' => 584048755900, 'shop_product_id' => '', 'bn' => 'BR3136S0606', 'name' => '测试', 'product_attr' => array ( ), 'quantity' => 1, 'price' => '1111.00', 'amount' => '1111.0', 'pmt_price' => '1111.00', 'sale_price' => '', 'weight' => '', 'score' => '', 'status' => 'active', 'fx_oid' => NULL, 'cost_tax' => NULL, 'buyer_payment' => NULL, ), ), 'pmt_price' => 0, ), ), 'lastmodify' => '2018-12-11 14:13:57', 'auto_combine' => false, 'step_paid_fee' => '', 'step_trade_status' => '', );

    $a= kernel::single('erpapi_router_response')->set_node_id('1848109335')->set_api_name('ome.order.add')->dispatch($sdf);

      var_dump($a);
